package org.idea.spring.aop.version2.bean;

import org.aspectj.weaver.tools.PointcutExpression;
import org.aspectj.weaver.tools.PointcutParser;

/**
 * @Author linhao
 * @Date created in 4:09 下午 2021/5/7
 */
public class AspectJPointcut implements Pointcut{

    public String expression;

    public AspectJPointcut(String expression) {
        this.expression = expression;
    }

    @Override
    public String getExpression() {
        return this.expression;
    }

    @Override
    public PointcutExpression buildPointcutExpression() {
        PointcutParser parser = PointcutParser
                .getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution();
        return parser.parsePointcutExpression(this.expression);
    }
}
